package org.bugeden.netdisk.sync

import org.bugeden.netdisk.transfer.{Block, IDevice}

/**
 * Created by IntelliJ IDEA.
 * User: inotseeyou
 * Date: 2010-11-8
 * Time: 23:09:19
 * To change this template use File | Settings | File Templates.
 */
//todo
class Synchronizer(val localPath: String, val remotePath: String) {
  import Synchronizer._

  val device: IDevice = null
  //remote path is "/"
  def synchronize(): Unit = {
    //todo
  }

  def synchronizeDirectory(): Unit = {
    //todo
  }

  def uploadFilePath(localFileName: String, remoteFileName: String): Unit = {
    //todo
  }

  def isFilePathExist(localPath: String, remotePath: String): Boolean = {
    val id = getLocalFilePathId(localPath)
    try {
      device.read(Block(id))
    } catch {
      case ex: Exception => false
    }
    true
  }

}

object Synchronizer {
  //id => md5
  def getLocalFilePathId(lfp: String): String = {
    //todo
    ""
  }

  def getLocalFilePathSecId(): String = {
    //todo
    ""
  }

  def localPathChildList(lp: String): List[String] = {
    //todo
    List("")
  }

  def remotePathChildList(rp: String): List[String] = {
    //todo
    List("")
  }
}